# 第一阶段：构建前端
FROM node:23-alpine AS build-stage
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build

# 第二阶段：生产环境
FROM docker-hosted.jiker-inc.com/base/nginx:1.23.0
WORKDIR /app
COPY --from=build-stage /app/.next /var/www/html

ADD conf/proxy.conf /etc/nginx/conf.d/default.conf
ADD conf/nginx.conf /etc/nginx/nginx.conf

WORKDIR /var/www/html